﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AutoKeys
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Hook.CHoolKey _Hook;
        private Key LastKey;
        
        public MainWindow()
        {
            InitializeComponent();
            _Hook = new Hook.CHoolKey(Hook.CWindowsAPI.EventProcessMode.AnyProcess);
            _Hook.KeyDown += new EventHandler<Hook.MyKeyEventArgs>(_Hook_KeyDown);
            _Hook.KeyUp += new EventHandler<Hook.MyKeyEventArgs>(_Hook_KeyUp);
        }

        private void textBox1_GotFocus(object sender, RoutedEventArgs e)
        {
        }

        void _Hook_KeyUp(object sender, Hook.MyKeyEventArgs e)
        {
            //textBox1.Text += "</" + e.Key.ToString() + ">";
            //e.Handled = true;
        }

        void _Hook_KeyDown(object sender, Hook.MyKeyEventArgs e)
        {
            //if (LastKey != e.Key)
            //{
            //    LastKey = e.Key;
            //    textBox1.Text += "<" + e.Key.ToString() + ">";
            //}
            ////e.Handled = true;
        }

        private void textBox1_LostFocus(object sender, RoutedEventArgs e)
        {
        }
    }
}
